import Time from "time.js/time"

export default {
    install: function (Vue, options) {
        Object.assign(Vue.prototype, {
            formateDate(date) {
                return Time(date, "%y-%M-%d/%h:%m:%s")
            },
            formateSize(size) {
              var arr = ["b", "kb", "mb", "gb", "tb"];
              var i = 0;
              while (size >= 1024) {
                i++;
                size = size / 1024;
              }
              return Math.floor(size * 100) / 100 + arr[i];
            },
            propagation(name, args) {
                this.$emit(name, ...args);
            }
        })
    }
}